package com.gitee.wsl.mathematics.matrix.mat3.ext

import com.gitee.wsl.mathematics.matrix.mat3.Matrix3
import com.gitee.wsl.mathematics.matrix.mat3.MutableMat3.Companion.identity
import com.gitee.wsl.mathematics.matrix.mat3.MutableMatrix3
import com.gitee.wsl.mathematics.vector.vec2.Vec2f
import com.gitee.wsl.mathematics.vector.vec2.Vector2

/**
 * Note: You must clone or copy the values of this [Vec2f] due to the values of this referenced
 * [Vec2f] will change.
 *
 * @return this matrix's translation component
 */
val <T:Number> Matrix3<T, *,*>.translate get() = createVec2(m02,m12)

fun<T:Number> MutableMatrix3<T, *, *>.setTranslate(x: T, y: T){
    identity()
    m02 = x
    m12 = y
}

fun<T:Number> MutableMatrix3<T, *,*>.setTranslate(scale: Vector2<T, *>) = setTranslate(scale.x, scale.y)